import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DriverBasicInfoVO, DriverBasicInfoForm, DriverBasicInfoQuery } from '@/api/vehicle/driverBasicInfo/types';

/**
 * 查询驾驶员基本信息列表
 * @param query
 * @returns {*}
 */

export const listDriverBasicInfo = (query?: DriverBasicInfoQuery): AxiosPromise<DriverBasicInfoVO[]> => {
  return request({
    url: '/vehicle/driverBasicInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询驾驶员基本信息详细
 * @param id
 */
export const getDriverBasicInfo = (id: string | number): AxiosPromise<DriverBasicInfoVO> => {
  return request({
    url: '/vehicle/driverBasicInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增驾驶员基本信息
 * @param data
 */
export const addDriverBasicInfo = (data: DriverBasicInfoForm) => {
  return request({
    url: '/vehicle/driverBasicInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改驾驶员基本信息
 * @param data
 */
export const updateDriverBasicInfo = (data: DriverBasicInfoForm) => {
  return request({
    url: '/vehicle/driverBasicInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除驾驶员基本信息
 * @param id
 */
export const delDriverBasicInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/vehicle/driverBasicInfo/' + id,
    method: 'delete'
  });
};
